<template>
  <div class="main-container">
    <Table
      ref="tableRef"
      :choiceColumn="false"
      :columns="columns"
      :apiUrl="apiUrl"
      :showPage="true"
      :showHandle = "false"
      :showSearch="true"
      :defaultSort="defaultSort"
      :formData="formData"
    >
    </Table>
  </div>
</template>

<script setup>
import Table from "@/components/Table";
import { visitlogList } from "@/api/log";
const { proxy } = getCurrentInstance();
const defaultSort = ref({prop: 'createTime', order: 'descending'});

const columns = [
  {
    prop: "id",
    label: "编号",
    width: 100,
    align: "center",
  },
  {
    prop: "content",
    label: "日志内容",
    align: "center",
  },
  {
    prop: "logType",
    label: "日志类型",
    align: "center",
  },
  {
    prop: "createTime",
    label: "访问时间",
    align: "center",
    sortable:"custom"
  },
  {
    prop: "ipaddress",
    label: "访问ip",
    align: "center",
  },
];

const formData = [
    {
    type: "input",
    label: "ip",
    placeholder: "请填写访问ip",
    prop: "ipaddress",
    width: "70%",
    showRule: [],
    searchShow: true
  },
  {
    type: "select",
    label: "类型",
    placeholder: "请选择日志类型",
    prop: "logType",
    width: "70%",
    showRule: [],
    searchShow: true,
    searchOption: [
      { value: "1", label: "进入网站" },
      { value: "2", label: "首页" },
      { value: "3", label: "必需品" },
      { value: "4", label: "笔记" },
      { value: "5", label: "小李档案" },
    ],
  },
  {
    type: "datetimerange",
    label: "访问时间",
    placeholder: ["筛选访问时间(开始点)", "访问时间(结束点)"],
    prop: "createTime",
    default: [],
    showRule: [],
    searchShow: true,
  },
];

const apiUrl = {
  list: visitlogList
};

</script>

<style lang="scss" scoped></style>
